package com.runshu.newsmartark.adapter;

import android.text.TextUtils;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.runshu.newsmartark.R;
import com.runshu.newsmartark.entity.ProductsBean;
import com.runshu.newsmartark.util.TextDrawableUtils;

import java.util.List;

/**
 * Demo class
 *
 * @author yu
 * @date 2020/8/26
 * @decs：
 */

public class TakeStockAdapter extends BaseQuickAdapter<ProductsBean, BaseViewHolder> {
    public TakeStockAdapter(@Nullable List<ProductsBean> data) {
        super(R.layout.item_take_stock, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ProductsBean item) {
        helper.setText(R.id.tv_no, String.valueOf(helper.getAdapterPosition() + 1));
        helper.setText(R.id.tv_pro_name, item.getProductName());

        if (TextUtils.isEmpty(item.getProductModel())) {
            helper.setVisible(R.id.tv_pro_guige, false);
        } else {
            helper.setVisible(R.id.tv_pro_guige, true);
            helper.setText(R.id.tv_pro_guige, "规格：" + item.getProductModel());
        }
        helper.setText(R.id.tv_pro_company, "生产厂家：" + item.getManufacturer());
        helper.setText(R.id.tv_pro_num, String.valueOf(item.getStock()));

//                TextDrawableUtils.setDrawableRight(mContext,helper.getView(R.id.tv_pro_name), R.mipmap.icon_strat);

    }
}